package org.momo.rpc.util;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {

    public static byte[] md5(String key) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] keyBytes = key.getBytes(StandardCharsets.UTF_8);
            return md.digest(keyBytes);
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }

    }

}
